package com.xiashitech.agent.instrumentation.redis.jedis.inst;

import com.google.auto.service.AutoService;
import com.xiashitech.agent.instrumentation.redis.jedis.inst.XSBinaryJedisInstrumentation;
import com.xiashitech.agent.rule.usermatch.Register;
import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule;
import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import static java.util.Arrays.asList;

@AutoService(InstrumentationModule.class)
public class XSJedisInstrumentationModule extends InstrumentationModule {
    public XSJedisInstrumentationModule() {
        super("xs-jedis", "jedis-1.4");
    }

    @Override
    public List<TypeInstrumentation> typeInstrumentations() {
        return asList(new XSBinaryJedisInstrumentation(),new XSJedisInstrumentation());
    }

    @Override
    public List<String> getAdditionalHelperClassNames() {
        List<String> helperClassNames = new ArrayList();
        helperClassNames.addAll(Arrays.asList("com.xiashitech.agent.instrumentation.redis.jedis.XSJedisSingletons",
                "com.xiashitech.agent.instrumentation.redis.XSJedisAttributesExtractor"));
        helperClassNames.addAll(Register.registUserMatch());
        return helperClassNames;
    }
}
